package com.neusoft.neu24.nep.service.impl;

import com.neusoft.neu24.nep.client.RPCSysnodeServiceOpenFeignClient;
import com.neusoft.neu24.nep.entity.CommonResult;
import com.neusoft.neu24.nep.entity.Role;
import com.neusoft.neu24.nep.entity.Sysnode;
import com.neusoft.neu24.nep.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.client.WebClient;

import java.util.List;

@Service
public class RoleServiceImpl implements IRoleService {



    @Autowired
    private RPCSysnodeServiceOpenFeignClient client;


    @Override
    public CommonResult selectById(Integer roleid) {

        CommonResult<List<Sysnode>> result =client.selectSysnodesByRoleid(roleid);
        if (result.getCode() == 200){
            Role role =new Role();
            role.setId(roleid);
            role.setSysnodes( result.getResult() );
            return CommonResult.sucess(role);

        }else {
            return CommonResult.filure();
        }


    }
}
